#!/usr/bin/env node

const http = require('http'),
      log = console.log,
      url =  require('url'),
      add = process.argv[2];
//res为服务器返回的参数
http.get(add,(res)=>{
 // let data = '';
 // res.on('data',(chunk)=>{
  //  data +=chunk;
 // });
 // res.on('data',()=>{
  //  log(data)
 // })
 
  //print response start line
  //HTTP/1.1 200 ok
  log(`HTTP/${res.httpVersion} ${res.statusCode} ${res.statusMessage}`);

  //print response
  //Content-Length:22
  log(res.headers);
  res.pipe(process.stdout);
});
